﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Work.Weixin
{
    /// <summary>
    /// 缓存对某个app的gettoken的结果。
    /// </summary>
    public interface IAccessTokenCache
    {
        /// <summary>
        /// 某某公司.审计
        /// </summary>
        string AppName { get; }

        /// <summary>
        /// 尝试获取<paramref name="access_token"/>。
        /// </summary>
        /// <param name="expired_time">缓存的有效期是多少秒</param>
        /// <param name="access_token"></param>
        /// <returns></returns>
        bool TryGetAccessToken(int expired_time, out string access_token);

        /// <summary>
        /// 更新缓存
        /// </summary>
        /// <param name="content">更新后的内容</param>
        /// <param name="time">何时更新的？</param>
        void UpdateCache(string content, DateTime time);
    }

}
